package org.vigor.lab.gateway.zuul.filter;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
import org.vigor.lab.gateway.util.RequestAuditLog;

/**
 * LogPostZuulFilter
 * <p></p>
 *
 * @author Vigor Yuan
 */
public class LogPostZuulFilter extends ZuulFilter {
    @Override
    public String filterType() {
        return FilterConstants.POST_TYPE;
    }

    @Override
    public int filterOrder() {
        return FilterConstants.SEND_RESPONSE_FILTER_ORDER-1;
    }

    @Override
    public boolean shouldFilter() {
        return true;
    }

    @Override
    public Object run() {
        RequestContext ctx = RequestContext.getCurrentContext();
        RequestAuditLog.audit("ctx{}",ctx);
        return null;
    }
}
